<SCRIPT>
function SetRelationField(sFromValue, sToValue, sAssignValue, sRelatedFld, sDefault, oField) {
var aFrom, aTo, aAssign, nLen, nCnt, lInBetween=false

	aFrom=sFromValue.split(",")
	aTo=sToValue.split(",")
	aAssign=sAssignValue.split(",")
	nLen=aFrom.length

	for (nCnt=0; nCnt < nLen; nCnt++) {
		if (
			 (aFrom[nCnt] == "" && oField.value <= aTo[nCnt]) ||
			 (aTo[nCnt] == "" && oField.value >= aFrom[nCnt]) ||
			 (aFrom[nCnt] <= oField.value && oField.value <= aTo[nCnt])
		   )
		{
			eval("document.eForm.edt" + sRelatedFld + ".value='" + aAssign[nCnt] + "'")
			lInBetween=true
			break
		}
	}

	if (!lInBetween && sDefault != "")
		eval("document.eForm.edt" + sRelatedFld + ".value='" + sDefault + "'")
}

function ChangeTitle(sTitle, eAttachmentHandle) {
	if (eAttachmentHandle.document.title == "") {
		setTimeout("ChangeTitle(sTitle, eAttachmentHandle)", 1000)
		eAttachmentHandle.document.title=sTitle
	} else
		eAttachmentHandle.document.title=sTitle
}

function GetLastInput(oField) {
var sName=oField.name, nCnt, sChar, sDigit="0123456789",
	sSuffix="", nSuffix, sGivenName

	if (!oField.readonly && !oField.disabled)
	for (nCnt=sName.length; nCnt > 0; nCnt--) {
		sChar=sName.substring(nCnt, nCnt - 1)

		if (sDigit.indexOf(sChar) != -1)
			sSuffix=sChar + sSuffix
		else {
			sGivenName=sName.substring(0, nCnt)
			break
		}
	}


	if (sSuffix != "" && sSuffix != "1") {
		sSuffix=sSuffix - 1
		oField.value=eval("document.eForm." + sGivenName + sSuffix + ".value")
	}
}

function CheckeFormDate(oDate, dCutOff, sLateAppsMode) {
var dDate1, dDate2, lReturn=true

	with (oDate) {
		if (value != "" && !CheckDate(oDate)) {
			//alert("Invalid Date")
			value=""
			lReturn=false
		} else
			if (dCutOff != "") {
				dDate1=new Date(value)
				dDate2=new Date(dCutOff)

				if (sLateAppsMode == "1" && dDate1.valueOf() <= dDate2.valueOf()) {
					alert("Late Application is not accepted.")
					value=""
					lReturn=false
				} else
					if (sLateAppsMode == "2" && dDate1.valueOf() >= dDate2.valueOf()) {
						alert("Advance Application is not accepted.")
						value=""
						lReturn=false
					}
			}
	}

return(lReturn)
}
//10/03/2011 - Added by Teki to check if there is attached file.
function checkform(){
	if (eForm.eformfileattachment1.value == "" || eForm.eformfileattachment1.value == null){
		alert("Must have attachments1!");
		event.returnValue=false;
		return false
	}else if(eForm.edtCOMMENTS.value == ""){
		alert("Must have comment!");
		event.returnValue=false;
		return false;
	}else{
		window.confirm('Route this form?');
	}

}


function checkComments(){
	if(eForm.edtCOMMENTS.value == ""){
		alert("Must have comment!");
		event.returnValue=false;
		return false;
	}
	//else{
	//	return true;
	//}
}

function checkCheckbox1(){
	if (eForm.chkDelFileAtt1.checked == true && eForm.eformfileattachment1.value == ""){
		alert("Must have attachment2!");
		event.returnValue=false;
		return false;
	}else if(eForm.edtCOMMENTS.value == ""){
		alert("Must have comment!");
		event.returnValue=false;
		return false;
	}else{
		if (window.confirm('Route this form?')){
			return true;
		} 
		else{
			alert("Must have attachments!");
			return false;
		}
	}
}

</SCRIPT>
<CFSET sFieldWthFormat="">
<CFINCLUDE TEMPLATE="#client.common_path#popdate.cfm">
<!--- get records for the eform to add or edit --->
<CFIF NOT(isDefined("Form.Add"))>
	<CFQUERY NAME="GetEntry" DATASOURCE="#table_dsn#" MAXROWS=1>
    	SELECT *
		FROM #GetForm.TABLENAME_FK#
		WHERE
			(PERSONNELIDNO = '#GetEmployee.PERSONNELIDNO#')
			<CFLOOP  INDEX="x" FROM="1" TO="5">
				<CFIF evaluate("GetForm.PK_FIELD" & x) NEQ "">
					<CFSET theVal = evaluate("url." & evaluate("GetForm.PK_FIELD" & x))>
					AND (#ucase(evaluate("GetForm.PK_FIELD" & x))# = '#theVaL#')
				</CFIF>
			</CFLOOP>
   </CFQUERY>
	<!---
	<cfoutput query="GetFields">
		<cfset sEntV = evaluate("GetEntry." & #COLUMNNAME#)>
		#sEntV# <br />
	</cfoutput>
	--->
	<CFIF NOT(GetEntry.RecordCount)>
		<CFSET appname1	= "Editing " & GetForm.DESCRIPTION>
			<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TITLE="#appname1#">
		<BR><BR><B>Unauthorized access detected!</B><BR><BR>
		Please use the standard editor to avoid
		being reported for illegal use of the software.
		<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TOP="False">
		<CFABORT>
	</CFIF>
	<CFSET appname1	= "Editing " & GetForm.DESCRIPTION>
	<CFSET sAction 	= "Update">
<CFELSE>
	<CFSET appname1	= "Adding " & GetForm.DESCRIPTION>
	<CFSET sAction 	= "Save ">

</CFIF>

<CFIF ParameterExists(url.replicate)>
	<CFSET appname1	= "Copying " & GetForm.DESCRIPTION>
	<CFSET sAction 	= "Replicate">
</CFIF>

<!--- routing --->
<CFSET lValidRoute = True>

<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">
<TR>
<TD>
	<CFOUTPUT>
	<FORM ACTION="#eform.sender#?pid=#pidno#" METHOD="post" NAME="eForm" ENCTYPE="multipart/form-data">
	<!--- no data-flow if eforms doesnt have processcode attached in it and eforms table doesnt have routeid --->
	<CFIF NOT ParameterExists(url.replicate) AND (Trim(GetForm.PROCESSCODE) NEQ "" AND IsDefined("GetEntry.ROUTEID"))>
		<CFINCLUDE TEMPLATE="_dataflow.cfm">
	</CFIF>

	<!--- Added by Mhel, for pre-process validation/prompt --->
	<!--- Start --->
	<CFIF NOT isDefined("Form.Add")>
		<CFINCLUDE TEMPLATE="_preprocess.cfm">
	</CFIF>
	<!--- End --->

	<!--- Added by Soti, for eTasks Events - pre_activity event --->
	<!--- to be continued
	<CFSET runetaskeventID = "EVT20050216000000000000000000000001">
	<CFSET runetaskeventCompCode = "forms">
	<CFINCLUDE TEMPLATE="#client.common_path#cfm_runetaskevent.cfm">
	--->
	<!--- End --->
	<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TITLE="#appname1#">
	<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2 BGCOLOR="#client.color_tblhead#" WIDTH="100%" HEIGHT=33>
		<TR>
			<!---TD NOWRAP--->
			<TD CLASS="white" NOWRAP><!--- Changed by Badz 07162009 --->
				&nbsp;
				<INPUT TYPE="submit" NAME="Save"  VALUE="#sAction#" CLASS="bitbtn" onClick="return checkComments()">
				<INPUT TYPE="submit" NAME="Cancel" VALUE="Back" CLASS="bitbtn">
				<input type="hidden" name="hdpid" value="#GetEntry.PERSONNELIDNO#" />
				<CFIF lcase(accessEmail) EQ "y">
					<INPUT TYPE="submit" NAME="Savemail" VALUE="#sAction# and eMail" CLASS="bitbtn">
				</CFIF>
			<!---/TD--->
			<CFIF len(trim(GetForm.PROCESSCODE)) NEQ 0 AND sAction EQ "Update">
				<!---TD CLASS="white" ALIGN="right" NOWRAP---><!--- Comment out first line 164, 166 to transfer route button to left - Badz 07162009--->
					&nbsp;&nbsp;&nbsp;&nbsp;
					Include eForm:<input type="radio" name="rdoIncludeForm" value="Y">Yes
					<input type="radio" name="rdoIncludeForm" value="N" checked>No
					&nbsp;&nbsp;&nbsp;&nbsp;Priority:&nbsp;
					<SELECT CLASS="regular11" NAME="cmbPriority" <CFIF NOT(lValidRoute)>DISABLED</CFIF>>
						<OPTION VALUE="1">&nbsp;High
						<OPTION VALUE="2" SELECTED>&nbsp;Normal&nbsp;
						<OPTION VALUE="3">&nbsp;Low
					</SELECT>
					&nbsp;
					
					<CFQUERY NAME="GetRecord" DATASOURCE="#client.company_dsn#">
						SELECT R.*, M.TABLENAME_FK, M.DESCRIPTION, M.PRIORITY, M.ORGENTITY, M.INCLUDEEFORM, M.ROUTEPARAMS
						FROM CRGROUTERECORDS R, CRGROUTEMAIN M
						WHERE
							(R.ROUTEID = M.ROUTEID) AND
							(RECORDID  = '#url.id#')<!--- AND
							(R.ISHIDE    = 'N')--->
					</CFQUERY>
					<CFIF GetRecord.RECORDCOUNT>
						<CFQUERY NAME="GetEntry" DATASOURCE="#table_dsn#">
							SELECT *
							FROM #GetRecord.TABLENAME_FK#
							WHERE
								(ROUTEID = '#GetRecord.ROUTEID#')
						</CFQUERY>
						<CFSET theURL= "ROUTEID=" & "#GetRecord.ROUTEID#">
					</CFIF>
					<cfquery name="checkAttachment" datasource="#company_dsn#">
						SELECT ATTACHMENTCODE
						FROM ECINDTRUPDATE
						WHERE PERSONNELIDNO = '#pidno#'
					</cfquery>
					<!--- Added by Teki 10/19/2011 Query To Check if there is an attachment or not --->
					<CFQUERY NAME="qryECINFORMSATTACH" DATASOURCE=#client.company_dsn#>
						SELECT *
						FROM ECINFORMSATTACH
						WHERE ATTACHMENTCODE = '#GetEntry.ATTACHMENTCODE#'
					</CFQUERY>
					<!--- Modified by Teki 10/19/2011 Conditon To Check if there is an attachment or not --->
					<CFIF (IsDefined("url.view") OR IsDefined("url.print") OR IsDefined("url.route") OR IsDefined("url.EDIT") OR IsDefined("url.replicate")) >
						<cfif url.edit neq '1'>
							<CFIF FileExists("#ExpandPath(client.attachment_path)##qryECINFORMSATTACH.ATTACHFILECODE#.#ListLast(qryECINFORMSATTACH.DESCRIPTION, '.')#")>
								<INPUT <CFIF NOT(lValidRoute) OR (NOT lPreProcessValidated)>DISABLED</CFIF> TYPE="submit" NAME="Route" VALUE="#sAction# & Route" CLASS="regular11" onClick="return checkCheckbox1();">
							<cfelse>
								<INPUT <CFIF NOT(lValidRoute) OR (NOT lPreProcessValidated)>DISABLED</CFIF> TYPE="submit" NAME="Route" VALUE="#sAction# & Route" CLASS="regular11" onClick="return checkform();">
							</cfif>
						<cfelse>
							<cfif not qryECINFORMSATTACH.RecordCount OR qryECINFORMSATTACH.ATTACHMENTCODE eq ''>
								<INPUT <CFIF NOT(lValidRoute) OR (NOT lPreProcessValidated)>DISABLED</CFIF> TYPE="submit" NAME="Route" VALUE="#sAction# & Route" CLASS="regular11" onClick="return checkform();">
							<cfelse>
								<INPUT <CFIF NOT(lValidRoute) OR (NOT lPreProcessValidated)>DISABLED</CFIF> TYPE="submit" NAME="Route" VALUE="#sAction# & Route" CLASS="regular11" onClick="return checkCheckbox1();">
							</cfif>
						</cfif>
					<cfelse>
						<cfif not qryECINFORMSATTACH.RecordCount OR qryECINFORMSATTACH.ATTACHMENTCODE eq ''>
							<INPUT <CFIF NOT(lValidRoute) OR (NOT lPreProcessValidated)>DISABLED</CFIF> TYPE="submit" NAME="Route" VALUE="#sAction# & Route" CLASS="regular11" onClick="return checkform();">
						<cfelse>
							<INPUT <CFIF NOT(lValidRoute) OR (NOT lPreProcessValidated)>DISABLED</CFIF> TYPE="submit" NAME="Route" VALUE="#sAction# & Route" CLASS="regular11" onClick="return confirmThis('Route this form');">
						</cfif>
					</cfif>
					&nbsp;
					<input type="hidden" name="myPID" value="#pidno#" />
				</TD>
			</CFIF>
		</TR>
	</TABLE>
	</CFOUTPUT>

	<HR>
	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=5 WIDTH="100%">
		<CFOUTPUT>
		<TR VALIGN="bottom">
			<TD ALIGN="right"><IMG SRC="#client.image_path##session.site_ibose#"></TD>
			<TD NOWRAP CLASS="bold14" WIDTH="100%"><FONT FACE="Impact" SIZE="+2">#client.companyname#</FONT><BR>#GetForm.DESCRIPTION#</TD>
			<!--- <TD NOWRAP ALIGN="right"><IMG SRC="#client.icon_path#print.gif" BORDER=0> <A HREF="javascript: window.print();" CLASS="regular11">Printable version</A></TD> --->
		</TR>
		</CFOUTPUT>
	</TABLE>

	<!--- get column count --->
	<CFSET nColumnCount=1>
	<CFSET nTempCount=1>
	<CFSET sPrevSameRow="">

	<CFOUTPUT QUERY="GetFields">
		<CFIF sPrevSameRow IS "Y">
			<CFSET nTempCount=nTempCount + 1>
		<CFELSE>
			<CFIF nTempCount GT nColumnCount>
				<CFSET nColumnCount=nTempCount>
			</CFIF>
			<CFSET nTempCount=1>
		</CFIF>

		<CFSET sPrevSameRow=UCase(GetFields.SAMEROW)>
	</CFOUTPUT>

	<CFSET nTotalCell=3 * nColumnCount>

	<CFSET lSameRow=false>
	<CFSET nCellLoop=2>

	<!--- get attachments --->
	<CFINCLUDE TEMPLATE="..\common\_getattachments.cfm">

	<TABLE BORDER=0 CELLSPACING=3 CELLPADDING=0 WIDTH="100%" BGCOLOR="#FFFFFF">

	<!--- get list of primary keys for checking. primary keys must exist either as visible or hidden fields --->
	<CFSET primaryKeys = "PERSONNELIDNO,GUID">
	<CFLOOP  INDEX="x" FROM="1" TO="5">
		<CFIF evaluate("GetForm.PK_FIELD" & x) NEQ "" AND listFind(primaryKeys,evaluate("GetForm.PK_FIELD" & x)) EQ 0>
			<CFSET primaryKeys = listAppend(primaryKeys, evaluate("GetForm.PK_FIELD" & x))>
		</CFIF>
	</CFLOOP>

	<!--- get Editable groups for originator --->
	<CFQUERY NAME="getECRTFORMSGROUP" DATASOURCE="#client.company_dsn#">
		SELECT FIELDGROUP FROM ECRTFORMSGROUP
		WHERE FORMCODE='#GetForm.FORMCODE#'
			AND FORMDETAILCODE='#GetForm.FORMCODE#'
			AND PROCESSCODE = '#GetForm.PROCESSCODE#'
			AND ACTIVITYID = 'ORIGINATOR'
	</CFQUERY>
	<CFSET sLastFieldGrp = "">
	<CFSET lstEditableGrp = getECRTFORMSGROUP.FIELDGROUP>
	<!---{{{ Loop Fields --->
	<cfset client.getcountfields = 0 >
	<CFOUTPUT QUERY="GetFields" GROUP="FIELDGROUP">
		<CFSET lRelFieldReadOnly="">
		<CFIF len(trim(FIELDGROUP)) NEQ 0>
		<TR>
			<TD COLSPAN=#nTotalCell#>
				<CFMODULE TEMPLATE="#client.common_path#cfm_group.cfm" CAPTION="#FIELDGROUP#">
			</TD>
		</TR>
		</CFIF>

		<CFOUTPUT>
		<!--- Remove from primary key list if field will be shown on form--->
		<CFIF listFind(primaryKeys, GetFields.COLUMNNAME) NEQ 0>
			<CFSET primaryKeys = listDeleteAt(primaryKeys,listFind(primaryKeys, COLUMNNAME))>
		</CFIF>

		<CFMODULE TEMPLATE="#client.common_path#cfm_bosesize.cfm" CURRENTSIZE=#DISPLAYWIDTH#>
		<CFSET boseDISPLAYWIDTH = BOSESIZE>
		<!---{{{ Start: for Field relation --->
		<CFQUERY NAME="qryECRGFLDRELATIONKEY" DATASOURCE=#client.company_dsn#>
			SELECT *
			FROM ECRGFLDRELATION
			WHERE FORMCODE = '#GetForm.FORMCODE#' AND
				  KEYFIELD = '#COLUMNNAME#'
		</CFQUERY>


		<CFIF qryECRGFLDRELATIONKEY.RecordCount>
			<CFSET sFromValue="">
			<CFSET sToValue="">
			<CFSET sAssignValue="">
			<CFSET sRelatedFld=qryECRGFLDRELATIONKEY.RELATEDFIELD>
			<CFSET sComma="">

			<!--- Check if related field is included in GetFields --->
			<CFQUERY NAME="qryRelatedExist" DBTYPE="query">
				SELECT DEFAULTVALUE
				FROM GetFields
				WHERE COLUMNNAME = '#qryECRGFLDRELATIONKEY.RELATEDFIELD#'
			</CFQUERY>

			<CFIF qryRelatedExist.RecordCount>
				<CFSET sDefault=qryRelatedExist.DEFAULTVALUE>

				<CFQUERY NAME="qryECRGFLDRELATNDTL" DATASOURCE=#client.company_dsn#>
					SELECT *
					FROM ECRGFLDRELATNDTL
					WHERE FIELDRELATIONCODE = '#qryECRGFLDRELATIONKEY.FIELDRELATIONCODE#'
				</CFQUERY>

				<CFLOOP QUERY="qryECRGFLDRELATNDTL">
					<CFSET sFromValue=sFromValue & sComma & Trim(qryECRGFLDRELATNDTL.VALUE_FROM)>
					<CFSET sToValue=sToValue & sComma & Trim(qryECRGFLDRELATNDTL.VALUE_TO)>
					<CFSET sAssignValue=sAssignValue & sComma & Trim(qryECRGFLDRELATNDTL.VALUE_ASSIGN)>
					<CFSET sComma=",">
				</CFLOOP>
			</CFIF>
		<CFELSE>
			<CFSET sFromValue="">
		</CFIF>

		<CFQUERY NAME="qryECRGFLDRELATIONREL" DATASOURCE=#client.company_dsn#>
			SELECT *
			FROM ECRGFLDRELATION
			WHERE FORMCODE = '#GetForm.FORMCODE#' AND
				  RELATEDFIELD = '#COLUMNNAME#'
		</CFQUERY>

		<CFSET sCurrFieldGrp = "#COLUMNNAME#">

		<CFIF qryECRGFLDRELATIONREL.RecordCount>
			<CFSET lRelFieldReadOnly="readonly">
		<CFELSE>
			<CFIF UCase(ISEDITABLEEFORM) IS "N">
				<CFSET lRelFieldReadOnly="readonly">
			<CFELSE>
				<CFSET lRelFieldReadOnly="">
			</CFIF>

			<!--- Uneditable on Route for Originators - wins --->
			<CFIF ListFindNoCase(lstEditableGrp, sCurrFieldGrp, "@,") EQ 0 AND lstEditableGrp NEQ "">
				<CFSET lRelFieldReadOnly="readonly">
			</CFIF>
		</CFIF>
		<!---}}} End: for Field relation --->

		<!---<CFSET sLastFieldGrp = sCurrFieldGrp>--->

		<!---{{{ Start: for autofield --->
		<CFQUERY NAME="qryAutoField" DATASOURCE="#client.global_dsn#">
			SELECT COLUMNNAME, AUTOLOOKUPFLD
			FROM GRGBOSETABLEFIELDS
			WHERE
				(TABLENAME = '#GetForm.TABLENAME_FK#') AND
				(ISVISIBLEEFORM   = 'Y' OR ISVISIBLEEFORM IS NULL) AND
				(AUTOFIELD = '#COLUMNNAME#')
		</CFQUERY>
		<!---}}} End: for autofield --->

		<!--- get the value of the entry --->
		<CFPARAM NAME="Form.edt#COLUMNNAME#" DEFAULT="">
		<CFIF (sAction EQ "Replicate" OR sAction EQ "Update" OR sAction EQ "Save")>
			<CFSET sEntryValue = evaluate("GetEntry." & COLUMNNAME)>
		<CFELSE>
			<!--- get the task's date or the default value --->
			<CFIF ParameterExists(url.alttaskid) AND (GetForm.CALENDARFIELD EQ COLUMNNAME)>
				<CFSET sEntryValue = url.alttaskid>
			<CFELSE>
				<!---<CFSET sEntryValue = DEFAULTVALUE>--->
				<CFMODULE TEMPLATE="#client.common_path#get_default_value.cfm" EntryValue="#DEFAULTVALUE#">
				<CFSET sEntryValue = sDefaultValue>
			</CFIF>
		</CFIF>
		<CFIF NOT IsSimpleValue(sEntryValue)>
			<CFSET sEntryValue = "">
		</CFIF>
		<CFIF (CurrentRow NEQ RecordCount AND UCase(SAMEROW[CurrentRow + 1]) IS "Y") OR
			  (UCase(SAMEROW) IS "Y")>

			<CFIF UCase(SAMEROW) NEQ "Y" AND lSameRow>
				<CFLOOP INDEX="x" FROM=#nCellLoop# TO=#nColumnCount#>
					<TD></TD><TD></TD><TD></TD>
				</CFLOOP>
				</TR>
				<CFSET lSameRow=false>
				<CFSET nCellLoop=2>
			</CFIF>

			<CFIF NOT lSameRow>
				<TR>
			</CFIF>
			<TD NOWRAP WIDTH="150">&nbsp;&nbsp;#COLUMNDESC#:</TD>
			<TD NOWRAP CLASS="bold14">
				<CFIF lcase(COLUMNREQUIRED) EQ "y">*</CFIF>
				&nbsp;
			</TD>
			<TD align="left" nowrap>
			<!--- stop here --->
			<CFSET lSameRow=true>
			<CFSET nCellLoop=nCellLoop + 1>
		<CFELSE>
			<CFIF lSameRow>
				<CFLOOP INDEX="x" FROM=#nCellLoop# TO=#nColumnCount#>
					<TD></TD><TD></TD><TD></TD>
				</CFLOOP>
				</TR>
			</CFIF>

			<CFSET lSameRow=false>
			<CFSET nCellLoop=2>
			<TR>
			<TD NOWRAP WIDTH="150">&nbsp;&nbsp;#COLUMNDESC#:</TD>
			<TD NOWRAP CLASS="bold14">
				<CFIF lcase(COLUMNREQUIRED) EQ "y">*
				<CFELSE>
					<CFIF ListFind(sListPrimary,COLUMNNAME) NEQ 0>
					*
					</CFIF>
				</CFIF>
				&nbsp;
			</TD>
			<TD align="left" nowrap>
		</CFIF>

		<!---
		<TD NOWRAP VALIGN="top">#COLUMNDESC#:</TD>
		<TD NOWRAP CLASS="bold14">
			<CFIF lcase(COLUMNREQUIRED) EQ "y">*</CFIF>
			&nbsp;
		</TD>
		<TD VALIGN="top" WIDTH="100%" nowrap>
		--->
		<!--- For extra desc in lookup --->
		<CFSET lWithExtra=false>

		<!--- store the original value --->
		<INPUT TYPE="hidden" NAME="old#COLUMNNAME#" VALUE="#HTMLEditFormat(sEntryValue)#">

		<!--- Added by Mhel for Autogen Field --->
		<!--- Start --->
		<CFQUERY DATASOURCE="#client.global_dsn#" NAME="autogen">
			SELECT *
			FROM GSTAUTOGENFIELD
			WHERE TABLENAME = '#getform.TABLENAME_FK#' AND
				  FIELDNAME = '#COLUMNNAME#'
		</CFQUERY>
		<CFIF autogen.RecordCount>
			<CFSET lAutoGen="Yes">
		<CFELSE>
			<CFSET lAutoGen="No">
		</CFIF>
		<!--- End --->

		<!--- check on what form control to use --->
		<CFSWITCH EXPRESSION="#lcase(COLUMNTYPE)#">

			<!--- calculator lookup --->
			<CFCASE VALUE="ftCurrency">
				<CFSET sFieldWthFormat=ListAppend(sFieldWthFormat,"edt#COLUMNNAME#")>
				<INPUT TYPE="text" NAME="edt#COLUMNNAME#"
					SIZE="15" MAXLENGTH="15"
					VALUE="#sEntryValue#" ALIGN="RIGHT"
					#lRelFieldReadOnly#
					onBlur="formatNumber(this)">
			</CFCASE>
			<CFCASE VALUE="ftinteger">
				<INPUT TYPE="text" NAME="edt#COLUMNNAME#"
					SIZE="15" MAXLENGTH="15"
					VALUE="#sEntryValue#" ALIGN="RIGHT"
					onkeyup="CheckDigit('0123456789', this)"
					#lRelFieldReadOnly#
					<CFIF sFromValue NEQ "">
						ONCHANGE="SetRelationField('#sFromValue#', '#sToValue#', '#sAssignValue#', '#sRelatedFld#', '#sDefault#', this)"
					</CFIF>
					ondblclick="GetLastInput(this)">
			</CFCASE>

			<!--- calculator lookup --->
			<CFCASE VALUE="ftsmallint">
				<INPUT TYPE="text" NAME="edt#COLUMNNAME#"
					SIZE="15" MAXLENGTH="15"
					VALUE="#sEntryValue#" ALIGN="RIGHT"
					onkeyup="CheckDigit('0123456789', this)"
					#lRelFieldReadOnly#
					<CFIF sFromValue NEQ "">
						ONCHANGE="SetRelationField('#sFromValue#', '#sToValue#', '#sAssignValue#', '#sRelatedFld#', '#sDefault#', this)"
					</CFIF>
					ondblclick="GetLastInput(this)">
			</CFCASE>

			<!--- calculator lookup --->
			<CFCASE VALUE="ftfloat">
				<INPUT TYPE="text" NAME="edt#COLUMNNAME#"
					SIZE="15" MAXLENGTH="15"
					VALUE="#sEntryValue#" ALIGN="RIGHT"
					onkeyup="CheckDigit('0123456789.', this)"
					onblur="if (this.value != '') {CheckValue(this, 0, 'Y')};"
					#lRelFieldReadOnly#
					<CFIF sFromValue NEQ "">
						ONCHANGE="SetRelationField('#sFromValue#', '#sToValue#', '#sAssignValue#', '#sRelatedFld#', '#sDefault#', this)"
					</CFIF>
					ondblclick="GetLastInput(this)">
			</CFCASE>

			<!--- calendar lookup --->
			<CFCASE VALUE="ftdatetime">
			<CFMODULE TEMPLATE="#client.common_path#get_default_value.cfm" EntryValue="#sEntryValue#">
			<INPUT TYPE="text" NAME="edt#COLUMNNAME#"
				SIZE="15" MAXLENGTH="10"
				<CFIF sDefaultValue NEQ "">
					<CFIF sDefaultValue EQ "01/01/1900">
						VALUE=""
					<CFELSE>
						VALUE="#DateFormat(sDefaultValue,"mm/dd/yyyy")#"
					</CFIF>
				<CFELSE>
					VALUE = "#sDefaultValue#"
				</CFIF>
				onkeyup="CheckDigit('0123456789/', this)"
				#lRelFieldReadOnly#
				<CFIF sFromValue NEQ "">
					ONCHANGE="SetRelationField('#sFromValue#', '#sToValue#', '#sAssignValue#', '#sRelatedFld#', '#sDefault#', this)"
				</CFIF>
				<!--- check if with late application validation --->
				<CFIF Trim(LCase(COLUMNNAME)) IS Trim(LCase(GetForm.FLDFORLATEAPPS))>
					<CFIF isDefined("Form.Add") OR isDefined("url.replicate")>
						<CFSET dCutOffDate=Now()>
					<CFELSE>
						<CFSET dCutOffDate=GetEntry.RECDATECREATED>
						<CFIF dCutOffDate IS "">
							<CFSET dCutOffDate="01/01/1900">
						</CFIF>
					</CFIF>

					<CFIF GetForm.GRACEPRDLATEAPPS NEQ "" AND GetForm.GRACEPRDLATEAPPS NEQ 0>
						<CFIF GetForm.LATEAPPSMODE IS 1>
							<CFSET nGracePrd=(GetForm.GRACEPRDLATEAPPS * -1)>
						<CFELSE>
							<CFSET nGracePrd=GetForm.GRACEPRDLATEAPPS>
						</CFIF>
						<CFSET dCutOffDate=DateAdd("d", nGracePrd, dCutOffDate)>
					</CFIF>

					<CFSET dCutOffDate=DateFormat(dCutOffDate, "mm/dd/yyyy")>
				<CFELSE>
					<CFSET dCutOffDate="">
				</CFIF>
				onblur="return CheckeFormDate(this, '#dCutOffDate#', '#GetForm.LATEAPPSMODE#');"
				ondblclick="GetLastInput(this)"
				>
				<CFIF lRelFieldReadOnly NEQ "readonly">
				
				<!--- 
						Added parameters - cfColAppBody and cfColAppTitle\
						From the converted popdate.cfm to js_popdate.js
						
						by   :  Alven M. Alinan
						date :  2011-05-24
				--->
				<A HREF="javascript:ShowCalendar('eForm', 'edt#COLUMNNAME#', '#cfColAppBody#', '#cfColAppTitle#');">
					<IMG SRC="#client.icon_path#calendar.gif" BORDER="0" ALT="View Calendar" ALIGN="bottom">
				</A>
				<CFELSE>
				<IMG SRC="#client.icon_path#calendar.gif" BORDER="0" ALT="View Calendar" ALIGN="bottom">
				</CFIF>
			</CFCASE>

			<!--- memo fields --->
			<CFCASE VALUE="ftmemo">
				<TEXTAREA COLS="#boseDISPLAYWIDTH#" ROWS="4" NAME="edt#COLUMNNAME#"
				#lRelFieldReadOnly#
				<CFIF sFromValue NEQ "">ONCHANGE="SetRelationField('#sFromValue#', '#sToValue#', '#sAssignValue#', '#sRelatedFld#', '#sDefault#', this)"</CFIF>
				ondblclick="GetLastInput(this)">#HTMLEditFormat(sEntryValue)#</TEXTAREA>
			</CFCASE>

			<!--- blob fields --->
			<CFCASE VALUE="ftblob">
				interface not supported.
			</CFCASE>

			<!--- images (asks for paths) --->
			<CFCASE VALUE="ftgraphic">
					interface not supported.
			</CFCASE>

			<CFDEFAULTCASE>
				<!--- there's a lookup --->
				<CFQUERY NAME="GetLookup" DATASOURCE="#client.global_dsn#">
					SELECT A.*, B.LEVELID
					FROM GSTLOOKUP A, GRGBOSETABLE B
					WHERE
						(A.MASTERTABLE = '#GetForm.TABLENAME_FK#') AND
						(A.MASTERFIELD = '#COLUMNNAME#') AND
						(A.LOOKUPTABLE = B.TABLENAME)
						</CFQUERY>
				<CFIF GetLookup.RecordCount>

					<!--- get length of description --->
					<CFQUERY NAME="qryDescLength" DATASOURCE=#client.global_dsn#>
						SELECT PHYSICALWIDTH
						FROM GRGBOSETABLEFIELDS
					WHERE TABLENAME = '#GetLookup.LOOKUPTABLE#' AND
							  COLUMNNAME = '#GetLookup.LOOKUPRESULTFIELD#'
					</CFQUERY>

					<CFIF qryDescLength.PHYSICALWIDTH NEQ "" AND
							qryDescLength.PHYSICALWIDTH NEQ 0>
						<CFSET sLkUpDescLength=qryDescLength.PHYSICALWIDTH + 5>
					<CFELSE>
						<CFSET sLkUpDescLength=50>
					</CFIF>
					<CFIF (GetLookup.FILTERSYMBOL NEQ "[null]" AND GetLookup.FILTERSYMBOL NEQ " ")>
						<CFSET sfldFilter="#GetLookup.FILTERFIELD#" & "#GetLookup.FILTERSYMBOL#">
						<CFSET sfldVal="#GetLookup.FILTERVALUE#">
					<CFELSE>
						<CFSET sfldFilter="">
						<CFSET sfldVal="">
					</CFIF>
					<CFIF (GetLookup.FILTERSYMBOL2 NEQ "[null]" AND GetLookup.FILTERSYMBOL2 NEQ " ")>
						<CFSET sfldFilter= sfldFilter & ",#GetLookup.FILTERFIELD2#" & "#GetLookup.FILTERSYMBOL2#">
						<CFSET sfldVal= sfldVal & ",#GetLookup.FILTERVALUE2#">
					<CFELSE>
						<CFSET sfldFilter="#sfldFilter#">
						<CFSET sfldVal="#sfldVal#">
					</CFIF>
					<CFIF (GetLookup.FILTERSYMBOL3 NEQ "[null]" AND GetLookup.FILTERSYMBOL3 NEQ " ")>
                                                <CFSET sfldFilter= sfldFilter & ",#GetLookup.FILTERFIELD3#" & "#GetLookup.FILTERSYMBOL3#">
						<CFSET sfldVal= sfldVal & ",#GetLookup.FILTERVALUE3#">
					<CFELSE>
						<CFSET sfldFilter="#sfldFilter#">
						<CFSET sfldVal="#sfldVal#">
					</CFIF>
					<CFSET sLkValue = "">
					<CFSET sLkextraValue = "">
					<CFIF (#trim(GetLookup.LEVELID)# IS "") OR
						(#trim(GetLookup.LOOKUPKEYFIELD)# IS "") OR
						(#trim(GetLookup.LOOKUPRESULTFIELD)# IS "") OR
						(#trim(GetLookup.LOOKUPTABLE)# IS "")>
						<I>*Lookup not properly setup.</I>
						<CFSET lGoodLkUp=false>
					<CFELSE>
						<CFSET lGoodLkUp=true>
						<!--- Get the datatype and description of display fields for lookup --->
						<CFQUERY NAME="qryDispLkUp" DATASOURCE=#client.global_dsn#>
							SELECT COLUMNNAME, COLUMNDESC, COLUMNTYPE, PHYSICALWIDTH, DISPLAYWIDTH
							FROM GRGBOSETABLEFIELDS
							WHERE (TABLENAME = '#Trim(GetLookup.LOOKUPTABLE)#') AND
								  (COLUMNNAME IN ('#Trim(GetLookup.LOOKUPKEYFIELD)#', '#Trim(GetLookup.LOOKUPRESULTFIELD)#'
								  <CFIF Trim(GetLookup.EXTRARESULTFLD) NEQ "">
									<CFSET lWithExtra=true>
									<CFLOOP LIST="#GetLookup.EXTRARESULTFLD#" INDEX="x">
										, '#Trim(x)#'
									</CFLOOP>
								  </CFIF>
								  ))
						</CFQUERY>

						<CFIF qryDispLkUp.RecordCount>
							<CFSET sLkFlds="">
							<CFSET sComma="">

							<!--- Put code and desc in front column --->
							<CFSET lstKeyValue=Valuelist(qryDispLkUp.COLUMNNAME)>
							<CFSET nPos=ListFindNoCase(#lstKeyValue#, GetLookup.LOOKUPKEYFIELD)>
							<CFIF nPos NEQ 0>
								<CFSET sLkFlds="#qryDispLkUp.COLUMNDESC[nPos]#~#qryDispLkUp.COLUMNNAME[nPos]#~#qryDispLkUp.COLUMNTYPE[nPos]#">
								<CFSET sComma=",">
							</CFIF>
							<CFSET nPos=ListFindNoCase(#lstKeyValue#, GetLookup.LOOKUPRESULTFIELD)>
							<CFIF nPos NEQ 0>
								<CFSET sLkFlds=sLkFlds & sComma & "#qryDispLkUp.COLUMNDESC[nPos]#~#qryDispLkUp.COLUMNNAME[nPos]#~#qryDispLkUp.COLUMNTYPE[nPos]#">
								<CFSET sComma=",">
							</CFIF>

							<CFSET tempStruct = StructNew()>
							<CFLOOP QUERY="qryDispLkUp">
								<CFIF qryDispLkUp.COLUMNNAME NEQ GetLookup.LOOKUPKEYFIELD AND
									  qryDispLkUp.COLUMNNAME NEQ GetLookup.LOOKUPRESULTFIELD>
									<CFTRY>
										<CFSET temp=structInsert(tempStruct, qryDispLkUp.COLUMNNAME,  "#qryDispLkUp.COLUMNDESC#~#qryDispLkUp.COLUMNNAME#~#qryDispLkUp.COLUMNTYPE#")>
									<CFCATCH TYPE="ANY">
									</CFCATCH>
									</CFTRY>
								</CFIF>
							</CFLOOP>
							<CFLOOP LIST="#GetLookup.EXTRARESULTFLD#" INDEX="i">
								<CFSET sLkFlds = listAppend(sLkFlds, structFind(tempStruct,i ))>
							</CFLOOP>
						<CFELSE>
							<CFSET sLkFlds="#GetLookup.LOOKUPKEYFIELD#~#GetLookup.LOOKUPKEYFIELD#~ftString">
						</CFIF>

						<CFSET sfrmflddesc="lk#COLUMNNAME#">
						<CFSET sflddesc="#GetLookup.LOOKUPRESULTFIELD#">
						<CFLOOP LIST="#GetLookup.EXTRARESULTFLD#" INDEX="x">

							<CFIF ListFind(sFields,"#Trim(x)#")>
								<CFSET sfrmflddesc=sfrmflddesc & ",edt#Trim(x)#">
							<CFELSE>
								<CFSET sfrmflddesc=sfrmflddesc & ",#GetLookup.MASTERFIELD#lk#Trim(x)#">
							</CFIF>

							<CFSET sflddesc=sflddesc & ",#Trim(x)#">
						</CFLOOP>

						<!--- Start: for autofield --->
						<CFLOOP QUERY="qryAutoField">
							<CFSET sfrmflddesc=sfrmflddesc & ",edt#qryAutoField.COLUMNNAME#">
							<CFSET sflddesc=sflddesc & ",#qryAutoField.AUTOLOOKUPFLD#">
						</CFLOOP>
						<!--- End: for autofield --->

						<!--- lookup edit --->

						<INPUT TYPE="text" NAME="hid#COLUMNNAME#"
							SIZE="15"
							MAXLENGTH="#PHYSICALWIDTH#" #lRelFieldReadOnly#
							VALUE="#sEntryValue#" ONBLUR="GetValue('#trim(GetLookup.LEVELID)#','#trim(GetLookup.LOOKUPTABLE)#','edt#COLUMNNAME#,hid#COLUMNNAME#',
						'eForm','#sLkFlds#','#trim(GetLookup.LOOKUPKEYFIELD)#','#sfrmflddesc#','#sflddesc#','#sfldFilter#','#sfldVal#',this.value)">
						<INPUT TYPE="hidden" NAME="edt#COLUMNNAME#"
							VALUE="#sEntryValue#">
						<CFIF lRelFieldReadOnly NEQ "readonly">
						<A HREF="javascript:ShowLookup('#trim(GetLookup.LEVELID)#','#trim(GetLookup.LOOKUPTABLE)#','edt#COLUMNNAME#,hid#COLUMNNAME#','eForm','#sLkFlds#','#trim(GetLookup.LOOKUPKEYFIELD)#','#sfrmflddesc#','#sflddesc#','#sfldFilter#','#sfldVal#')">
							<IMG SRC="#client.icon_path#lookup.gif" BORDER="0" ALT="Select from Lookup" ALIGN="bottom"></A>
						<CFELSE>
							<IMG SRC="#client.icon_path#lookup.gif" BORDER="0" ALT="Select from Lookup" ALIGN="bottom">
						</CFIF>
							<!--- get the description in the lookup --->
							<CFIF len(trim(sEntryValue)) NEQ 0>

								<!--- get table location --->
								<!--- custom tag: parameter: DBLEVEL; return value: DSN --->
								<CFMODULE TEMPLATE="#client.common_path#cfm_leveldsn.cfm" DBLEVEL="#GetLookup.LEVELID#">
								<CFSET lk_dsn = DSN>

								<CFQUERY NAME="GetLkDesc" DATASOURCE="#lk_dsn#">
									SELECT #GetLookup.LOOKUPRESULTFIELD#
									<!--- For extra lookup description --->
									<CFIF Trim(GetLookup.EXTRARESULTFLD) NEQ "">
										,#GetLookup.EXTRARESULTFLD#
									</CFIF>
									FROM #GetLookup.LOOKUPTABLE#
									WHERE
										(#GetLookup.LOOKUPKEYFIELD# = '#sEntryValue#')
								</CFQUERY>
								<CFIF GetLkDesc.RecordCount>
									<CFSET sLkValue = "#evaluate("GetLkDesc." & GetLookup.LOOKUPRESULTFIELD)#">
									<!--- For extra lookup description --->
									<CFLOOP LIST="#GetLookup.EXTRARESULTFLD#" INDEX="x">
										<CFSET sExtraDesc = "#evaluate("GetLkDesc." & Trim(x))#">
										<CFIF sExtraDesc IS "">
											<CFSET sExtraDesc=" ">
										</CFIF>
										<CFSET sLkextraValue=sLkextraValue & "#sExtraDesc#~~">
									</CFLOOP>
								<CFELSE>
									<CFSET sLkValue = "[value not found in the lookup.]">
								</CFIF>
							</CFIF>
					</CFIF>

					<!--- lookup description --->
					&nbsp;
					<INPUT READONLY TYPE="text" NAME="lk#COLUMNNAME#"
						SIZE="#sLkUpDescLength#"
						VALUE="#sLkValue#">

					<!--- for chart --->
					<CFIF LCase(ISORGCHART) IS "y" AND lGoodLkUp>
						<A HREF="javascript:ShowChart('#Trim(GetLookup.LEVELID)#','#Trim(GetLookup.LOOKUPTABLE)#','#Trim(GetLookup.LOOKUPKEYFIELD)#','#Trim(GetLookup.LOOKUPRESULTFIELD)#','hid#COLUMNNAME#','eForm', '#COLUMNDESC#')">
						<IMG SRC="#client.icon_path#lookup.gif" BORDER="0" ALT="Show Chart" ALIGN="bottom">
						</A>
					</CFIF>
				<CFELSE>

					<!--- there's a list lookup --->
					<CFIF len(trim(PICKLIST)) NEQ 0>

						<CFIF ListLen(PICKLIST) LTE 3>
							<CFLOOP INDEX="x" LIST="#PICKLIST#">
								<!--- Mhel added trim function in value --->
								<INPUT NAME="edt#COLUMNNAME#" <CFIF Trim(x) EQ Trim(sEntryValue)>CHECKED</CFIF> TYPE="radio" VALUE="#Trim(x)#" <CFIF lRelFieldReadOnly EQ "readonly">DISABLED</CFIF>>#x#
							</CFLOOP>
						<CFELSE>
							<SELECT NAME="edt#COLUMNNAME#" SIZE="1" <CFIF lRelFieldReadOnly EQ "readonly">DISABLED</CFIF>>
								<OPTION VALUE="">&nbsp;&nbsp;&nbsp;&nbsp;</OPTION>
								<CFLOOP INDEX="ListElement" LIST="#PICKLIST#" DELIMITERS=",">
									<CFIF #sEntryValue# EQ #ListElement#>
										<OPTION SELECTED VALUE="#ListElement#">#ListElement#</OPTION>
									<CFELSE>
										<OPTION VALUE="#ListElement#">#ListElement#</OPTION>
									</CFIF>
								</CFLOOP>
							</SELECT>
							<CFIF lRelFieldReadOnly EQ "readonly"><INPUT NAME="edt#COLUMNNAME#" TYPE="HIDDEN" VALUE="#sEntryValue#"></CFIF>
						</CFIF>

					<CFELSE>
						<!--- Added by Mhel for Auto gen --->
						<!--- Start --->
						<CFIF lAutoGen AND NOT IsDefined("url.edit")>
							<CFMODULE TEMPLATE="#client.common_path#autogenfield.cfm"
								SEEDKEY="#autogen.SEEDKEY#"
								CODELENGTH="#autogen.CODELENGTH#"
								COLUMNNAME="#GetFields.COLUMNNAME#"
								TABLENAME_FK="#getform.TABLENAME_FK#"
								DATASOURCE="#table_dsn#"
								WITHDATE="#autogen.WITHDATE#">
							<!---
							<CFMODULE TEMPLATE="#client.common_path#cfm_autogen.cfm"
								SEEDKEY="#autogen.SEEDKEY#"
								CODELENGTH="#autogen.CODELENGTH#"
								COLUMNNAME="#GetFields.COLUMNNAME#"
								TABLENAME_FK="#getform.TABLENAME_FK#"
								DATASOURCE="#table_dsn#">
							--->
							<CFSET sValue=AUTOGENVALUE>

							<!--- standard form edit --->
							<INPUT TYPE="text" NAME="edt#COLUMNNAME#" SIZE="#boseDISPLAYWIDTH#"
								MAXLENGTH="#PHYSICALWIDTH#" VALUE="#sValue#"
								READONLY>
						<CFELSE>
							<!--- End --->
							<!--- standard form edit --->
							<!--- Mhel added READONLY element for auto gen --->
							<INPUT TYPE="text" NAME="edt#COLUMNNAME#" SIZE="#boseDISPLAYWIDTH#"
								MAXLENGTH="#PHYSICALWIDTH#" VALUE="#HTMLEditFormat(sEntryValue)#"
								<CFIF lAutoGen>READONLY</CFIF>
								#lRelFieldReadOnly#
								<CFIF sFromValue NEQ "">
									ONCHANGE="SetRelationField('#sFromValue#', '#sToValue#', '#sAssignValue#', '#sRelatedFld#', '#sDefault#', this)"
								</CFIF>
								ondblclick="GetLastInput(this)"
								<CFIF GetFields.DISPLAYFORMAT NEQ "">onBlur="javascript: validateMasked(this,'#GetFields.DISPLAYFORMAT#');"</CFIF>>
						</CFIF>
					</CFIF>
				</CFIF>
			</CFDEFAULTCASE>
		</CFSWITCH>
		<CFIF HINT NEQ "">
			<BR>
			<I>#HINT#</I>
		</CFIF>
		</TD>
		<CFIF NOT lSameRow>
			<CFLOOP INDEX="x" FROM=#nCellLoop# TO=#nColumnCount#>
				<TD></TD><TD></TD><TD></TD>
			</CFLOOP>
			</TR>
		</CFIF>

		<!--- For extra desc in lookup --->
		<CFIF lWithExtra>
			<!--- For extra description in lookup --->
			<CFSET nLoopCnt=1>
			<CFSET lstKeyValue=Valuelist(qryDispLkUp.COLUMNNAME)>
			<CFLOOP LIST="#GetLookup.EXTRARESULTFLD#" INDEX="x">
				<CFSET x = trim(x)>
				<CFIF Trim(sLkextraValue) IS "">
					<CFSET sExtraDesc="">
				<CFELSE>
					<CFSET sExtraDesc=ListGetAt(#sLkextraValue#, nLoopCnt, "~~")>
					<CFSET nLoopCnt=nLoopCnt + 1>
				</CFIF>

				<TR>
					<CFSET nPos=ListFindNoCase(#lstKeyValue#, #x#)>
					<CFIF nPos NEQ 0>
						<CFSET sColDesc=#qryDispLkUp.COLUMNDESC[nPos]#>
						<CFSET sDataType=#qryDispLkUp.COLUMNTYPE[nPos]#>
						<CFSET sPhysicalWidth=#qryDispLkUp.PHYSICALWIDTH[nPos]#>
						<CFIF GetLookup.EXTRARESULTFLDLEN NEQ "" AND val(GetLookup.EXTRARESULTFLDLEN) NEQ "0">
							<CFSET sDisplayWidth=#val(GetLookup.EXTRARESULTFLDLEN)#>
						<CFELSE>
							<CFSET sDisplayWidth=#qryDispLkUp.DISPLAYWIDTH[nPos]#>
						</CFIF>
						<CF_IBOSELOG MODULE="EFORMS:perid" LEVEL="INFORMATION" FILE="editform.cfm"
						MESSAGE="--#sDisplayWidth#-----">
					<CFELSE>
						<CFSET sColDesc="">
						<CFSET sDataType="">
						<CFSET sPhysicalWidth="75">
						<CFSET sDisplayWidth="75">
					</CFIF>

					<CFIF NOT ListFind(sFields,#x#)>
					<TD NOWRAP>&nbsp;&nbsp;#sColDesc#:</TD>
					<TD NOWRAP CLASS="bold14">&nbsp;</TD>
					<TD WIDTH="100%" nowrap>
						<!--- check on what form control to use --->
						<CFSWITCH EXPRESSION="#LCase(sDataType)#">

						<!--- calculator lookup --->
						<CFCASE VALUE="ftinteger,ftfloat">
							<input size="15" class="regular11" type="text" READONLY name="#GetLookup.MASTERFIELD#lk#Trim(x)#" VALUE="#sExtraDesc#">
						</CFCASE>

						<!--- datetime lookup --->
						<CFCASE VALUE="ftdatetime">
							<input size="15" class="regular11" type="text" READONLY name="#GetLookup.MASTERFIELD#lk#Trim(x)#" <CFIF Trim(sExtraDesc) NEQ "">VALUE="#DateFormat(sExtraDesc, 'mm/dd/yyyy')#"</CFIF>>
						</CFCASE>

						<!--- memo fields --->
						<CFCASE VALUE="ftmemo">
							<TEXTAREA class="regular11" COLS="#sDisplayWidth#" ROWS="4" READONLY name="#GetLookup.MASTERFIELD#lk#Trim(x)#">#HTMLEditFormat(sExtraDesc)#</TEXTAREA>
						</CFCASE>

						<CFDEFAULTCASE>
							<input class="regular11" type="text" READONLY name="#GetLookup.MASTERFIELD#lk#Trim(x)#" SIZE="#sDisplayWidth#" MAXLENGTH="#sPhysicalWidth#" VALUE="#HTMLEditFormat(sExtraDesc)#">
						</CFDEFAULTCASE>
						</CFSWITCH>
					</TD>
					</CFIF>
					<CFLOOP INDEX="x" FROM=2 TO=#nColumnCount#>
						<TD></TD><TD></TD><TD></TD>
					</CFLOOP>
				</TR>
			</CFLOOP>
		</CFIF>

		</CFOUTPUT>
		
		
		
	</CFOUTPUT>
	<!---}}} End Loop Fields --->
	<CFIF lSameRow>
		<CFLOOP INDEX="x" FROM=#nCellLoop# TO=#nColumnCount#>
			<TD></TD><TD></TD><TD></TD>
		</CFLOOP>
		</TR>
	</CFIF>

	<CFIF UCase(Getform.ENABLEATTACHMENTS) IS "Y" AND NOT isDefined("url.replicate")>
		<CFOUTPUT>
		<TR>
			<TD COLSPAN="#nTotalCell#">
				<CFMODULE TEMPLATE="#client.common_path#cfm_group.cfm" CAPTION="Attach file here">
			</TD>
		</TR>
		<CFSET x="1">
		<CFLOOP FROM="1" TO="6" INDEX="x">
			<TR>
				<TD NOWRAP>&nbsp;&nbsp;File#x#:</TD>
				<TD>&nbsp;</TD>
				<TD WIDTH="100%" nowrap COLSPAN="#nTotalCell#"><INPUT TYPE="File" NAME="eformfileattachment#x#" SIZE=30></TD>
			</TR>
		</CFLOOP>
		
		<!---
		<TR>

			<TD NOWRAP>&nbsp;&nbsp;File1:</TD>
			<TD>&nbsp;</TD>
			<TD WIDTH="100%" nowrap COLSPAN="#nTotalCell#"><INPUT TYPE="File" NAME="eformfileattachment1" SIZE=30></TD>


		</TR>
		<TR>
			<TD NOWRAP>&nbsp;&nbsp;File2:</TD>
			<TD>&nbsp;</TD>
			<TD WIDTH="100%" nowrap COLSPAN="#nTotalCell#"><INPUT TYPE="File" NAME="eformfileattachment2" SIZE=30></TD>


		</TR>
		<TR>
			<TD NOWRAP>&nbsp;&nbsp;File3:</TD>
			<TD>&nbsp;</TD>
			<TD WIDTH="100%" nowrap COLSPAN="#nTotalCell#"><INPUT TYPE="File" NAME="eformfileattachment3" SIZE=30></TD>
		</TR>
		--->
		</CFOUTPUT>
	</CFIF>
	<CFIF UCase(Getform.ATTACHEDLINK) IS "Y">
	
		<TABLE BORDER=0 CELLSPACING=3 CELLPADDING=0 WIDTH="100%" BGCOLOR="#FFFFFF">
		<CFOUTPUT>
		<TR>
			<TD  WIDTH="100%" COLSPAN="10">
				<CFMODULE TEMPLATE="#client.common_path#cfm_group.cfm" CAPTION="Attach Link here">
			</TD>
		</TR>
		<TR>
			<tD WIDTH="20%" COLSPAN="2"></TD>
			<TD WIDTH="20%" COLSPAN="2" NOWRAP ALIGN="CENTER">&nbsp;&nbsp;Link Description *</TD>
			<TD WIDTH="20%" COLSPAN="2" NOWRAP ALIGN="CENTER">&nbsp;&nbsp;URL Location / Value *</TD>
			<tD WIDTH="20%" COLSPAN="2"></TD>
			<tD WIDTH="20%" COLSPAN="2"></TD>
		</TR>
		<CFLOOP FROM="1" TO="6" INDEX="x">
			<TR>
				<TD NOWRAP COLSPAN="2">&nbsp;&nbsp;Link #x#:</TD>
				<TD WIDTH="20%" nowrap COLSPAN="2"><INPUT TYPE="text" NAME="eformlinkdesc#x#" SIZE=30></TD>
				<TD WIDTH="20%" nowrap COLSPAN="2"><INPUT TYPE="text" NAME="eformlinkattach#x#" SIZE=50  value="http://"></TD>
				<tD COLSPAN="2"></TD>
				<tD COLSPAN="2"></TD>
			</TR>
		</CFLOOP>
		</CFOUTPUT>
		</TABLE>
	</CFIF>
	<!---{{{ Process Primary Keys w/o Form fields--->
	<CFLOOP list = "#primaryKeys#" INDEX="theColName">
		<CFSET theColValue="">
		<CFIF theColName EQ "PERSONNELIDNO">
			<!--- changed client.chapa to pidno variable --->
			<CFSET theColValue = pidno>
		<CFELSEIF theColName EQ "GUID">
			<CFQUERY NAME="checkGUIDExist" DATASOURCE="#client.global_dsn#">
				SELECT count(*) theCount
				FROM GRGBOSETABLEFIELDS
				WHERE
					(TABLENAME  = '#GetForm.TABLENAME_FK#') AND
					(COLUMNNAME <> 'GUID')
			</CFQUERY>
			<CFIF checkGUIDExist.theCount EQ 1>
				<!--- changed client.guid to GetUserInfo.GUID variable --->
				<CFSET theColValue = GetUserInfo.GUID>
			</CFIF>
		</CFIF>
		<CFOUTPUT>
		<INPUT TYPE="HIDDEN" NAME="edt#theColName#" VALUE="#theColValue#">
		<INPUT TYPE="HIDDEN" NAME="old#theColName#" VALUE="#theColValue#">
		</CFOUTPUT>
	</CFLOOP>
	
	</FORM>
	</TABLE>
	<HR>
	<I>* - Field that requires a value.
	<CFIF UCase(Getform.ENABLEATTACHMENTS) IS "Y">
		<br><br><B>Warning:</B> Files with these extensions are not allowed: [<B>.cfm, .cfml, .dbm, .dbml, .cgi, .pl, .plx, .vb, .js, .exe, .com, .vbs, .asp</B>]
	</CFIF>
</I>
<CFIF sFieldWthFormat NEQ "">
	<CFOUTPUT>
	<SCRIPT Language="javascript">
		<CFLOOP LIST="#sFieldWthFormat#" INDEX="x">
			formatNumber(document.eForm.#x#)
		</CFLOOP>
	</SCRIPT>
	</CFOUTPUT>
</CFIF>
	<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TOP="False">
</TD>
</TR>
</TABLE>

